<?php
$this->breadcrumbs=array(
		'access',
		'controller',
		'manage'
	);
?>


<?php
		Yii::app()->clientScript->registerScript('search', "
		$('.search-button').click(function(){
			$('.search-form').toggle();
			return false;
		});
		$('.search-form form').submit(function(){
			$.fn.yiiGridView.update('groupcontrollerrelation-grid', {
				data: $(this).serialize()
			});
			return false;
		});
		");
?>
<div class="admin_table">
<h1>Manage Relation</h1>
<div class="nav_wrap">
<?php echo CHtml::link('Create Controller',array('groupControllerRelation/create')); ?>
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
</div>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->



<?php if(Yii::app()->user->hasFlash('success')):?>
    <div style="color: green;" class="info">
        <?php echo '<b>'.Yii::app()->user->getFlash('success').'</b>'; ?>
    </div>
<?php endif; ?>
<?php
Yii::app()->clientScript->registerScript(
   'myHideEffect',
   '$(".info").animate({opacity: 1.0}, 3000).fadeOut("slow");',
   CClientScript::POS_READY
);
?>

<?php
 if(!empty($data))
$temp = CHtml::dropDownList("listname", "", $arrGroupList,array("options" => array($data->group_id=>array("selected"=>true)))); 
?>

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'groupcontrollerrelation-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
	
		array('name'=>'id','htmlOptions'=>array('width'=>'30')),

		array('name'=>'controller','htmlOptions'=>array('width'=>'100')),
		
		/*array(
            'name' => 'Action',
			'type' => 'raw',
           'value' => "'$temp'"
            //'filter' => CHtml::listData(Company::model()->findAll(), 'id', 'name')
        ),*/
		//'group_id',
		array(
            'name' => 'group_id',
			'type' => 'raw',
           	'value' => 'Group::model()->findByPk("$data->group_id")->name'
        ),
		array(
			'class'=>'CButtonColumn',
		 	'afterDelete'=>'function(link,success,data){ if(success) $("#statusMsg").html(data); }',
			'template' => '{update} {delete}',
			'buttons'=>array(
				
			),
		
			
			
			
			),
	),
	));
?>	
</div>